VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MsComCtl.ocx"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Object = "{B3FB64BF-91F9-11D7-A482-0008A14158BC}#2.22#0"; "ITGControls.ocx"
Begin VB.Form frmEnhanceWorkOrder 
   BackColor       =   &H00F7D9C2&
   BorderStyle     =   0  'None
   Caption         =   "Form1"
   ClientHeight    =   7545
   ClientLeft      =   0
   ClientTop       =   0
   ClientWidth     =   13860
   BeginProperty Font 
      Name            =   "Tahoma"
      Size            =   8.25
      Charset         =   0
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   KeyPreview      =   -1  'True
   LinkTopic       =   "Form1"
   MDIChild        =   -1  'True
   ScaleHeight     =   7545
   ScaleWidth      =   13860
   ShowInTaskbar   =   0   'False
   Begin MSComctlLib.StatusBar sbRS 
      Align           =   2  'Align Bottom
      Height          =   285
      Left            =   0
      TabIndex        =   38
      Top             =   7260
      Width           =   13860
      _ExtentX        =   24448
      _ExtentY        =   503
      _Version        =   393216
      BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628} 
         NumPanels       =   5
         BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Object.Width           =   3528
            MinWidth        =   3528
         EndProperty
         BeginProperty Panel2 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
         EndProperty
         BeginProperty Panel3 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Alignment       =   1
            AutoSize        =   1
            Bevel           =   0
            Object.Width           =   11220
            MinWidth        =   2
         EndProperty
         BeginProperty Panel4 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Object.Width           =   3528
            MinWidth        =   3528
         EndProperty
         BeginProperty Panel5 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Object.Width           =   3528
            MinWidth        =   3528
         EndProperty
      EndProperty
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
   End
   Begin ITGControls.ComunionFrames ComunionFrames2 
      Height          =   3255
      Left            =   0
      Top             =   3885
      Width           =   13635
      _ExtentX        =   24051
      _ExtentY        =   5741
      FrameColor      =   4210752
      BackColor       =   16243138
      FillColor       =   16243138
      RoundedCorner   =   0   'False
      Caption         =   "Details"
      Alignment       =   0
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ThemeColor      =   5
      ColorFrom       =   16243138
      ColorTo         =   16250865
      Begin ITGControls.ITGTab SSTab3 
         Height          =   2835
         Left            =   0
         TabIndex        =   40
         Top             =   420
         Width           =   13620
         _ExtentX        =   24024
         _ExtentY        =   5001
         TabCaption(0)   =   "     Parts     "
         TabContCtrlCnt(0)=   2
         Tab(0)ContCtrlCap(1)=   "dtgParts"
         Tab(0)ContCtrlCap(2)=   "cboParts"
         TabCaption(1)   =   "     Buy-Out     "
         TabContCtrlCnt(1)=   2
         Tab(1)ContCtrlCap(1)=   "dtgBuyout"
         Tab(1)ContCtrlCap(2)=   "cboBuyout"
         TabCaption(2)   =   "     Labor     "
         TabContCtrlCnt(2)=   1
         Tab(2)ContCtrlCap(1)=   "dtgLabor"
         TabTheme        =   2
         ActiveTabBackStartColor=   16250865
         ActiveTabBackEndColor=   16243138
         InActiveTabBackStartColor=   16243138
         InActiveTabBackEndColor=   16243138
         BeginProperty ActiveTabFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         BeginProperty InActiveTabFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         OuterBorderColor=   4210752
         TopLeftInnerBorderColor=   4210752
         BottomRightInnerBorderColor=   8421504
         DisabledTabBackColor=   16243138
         DisabledTabForeColor=   -2147483630
         Begin MSDataGridLib.DataGrid dtgBuyout 
            Height          =   2520
            Left            =   -75000
            TabIndex        =   18
            Top             =   315
            Width           =   13635
            _ExtentX        =   24051
            _ExtentY        =   4445
            _Version        =   393216
            AllowUpdate     =   -1  'True
            AllowArrows     =   -1  'True
            BackColor       =   16777215
            HeadLines       =   1
            RowHeight       =   15
            TabAcrossSplits =   -1  'True
            TabAction       =   2
            FormatLocked    =   -1  'True
            AllowDelete     =   -1  'True
            BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            ColumnCount     =   8
            BeginProperty Column00 
               DataField       =   "cItemType"
               Caption         =   "Product Type"
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   0
                  Format          =   ""
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   0
               EndProperty
            EndProperty
            BeginProperty Column01 
               DataField       =   "cItemNo"
               Caption         =   "Product ID"
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   0
                  Format          =   "0.00"
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   0
               EndProperty
            EndProperty
            BeginProperty Column02 
               DataField       =   "cDesc"
               Caption         =   "Description"
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   0
                  Format          =   ""
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   0
               EndProperty
            EndProperty
            BeginProperty Column03 
               DataField       =   "cUnit"
               Caption         =   "Unit"
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   0
                  Format          =   "0"
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   0
               EndProperty
            EndProperty
            BeginProperty Column04 
               DataField       =   "nQty"
               Caption         =   "Quantity"
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   1
                  Format          =   "#,##0.00"
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   1
               EndProperty
            EndProperty
            BeginProperty Column05 
               DataField       =   "nCost"
               Caption         =   "Cost"
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   1
                  Format          =   "#,##0.00"
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   0
               EndProperty
            EndProperty
            BeginProperty Column06 
               DataField       =   "nAmount"
               Caption         =   "Amount"
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   1
                  Format          =   "#,##0.00"
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   0
               EndProperty
            EndProperty
            BeginProperty Column07 
               DataField       =   "cRemarks"
               Caption         =   "Remarks"
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   0
                  Format          =   ""
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   0
               EndProperty
            EndProperty
            SplitCount      =   1
            BeginProperty Split0 
               BeginProperty Column00 
                  Button          =   -1  'True
                  Locked          =   -1  'True
                  ColumnWidth     =   1230.236
               EndProperty
               BeginProperty Column01 
                  Button          =   -1  'True
                  ColumnWidth     =   1409.953
               EndProperty
               BeginProperty Column02 
                  ColumnWidth     =   2684.977
               EndProperty
               BeginProperty Column03 
                  ColumnWidth     =   675.213
               EndProperty
               BeginProperty Column04 
                  Alignment       =   1
                  ColumnWidth     =   1124.787
               EndProperty
               BeginProperty Column05 
                  Alignment       =   1
                  ColumnWidth     =   1094.74
               EndProperty
               BeginProperty Column06 
                  Alignment       =   1
                  Locked          =   -1  'True
                  ColumnWidth     =   1275.024
               EndProperty
               BeginProperty Column07 
                  ColumnWidth     =   2700.284
               EndProperty
            EndProperty
         End
         Begin MSDataGridLib.DataGrid dtgParts 
            Height          =   2520
            Left            =   0
            TabIndex        =   44
            Top             =   315
            Width           =   13635
            _ExtentX        =   24051
            _ExtentY        =   4445
            _Version        =   393216
            AllowUpdate     =   -1  'True
            AllowArrows     =   -1  'True
            BackColor       =   16777215
            HeadLines       =   1
            RowHeight       =   15
            TabAcrossSplits =   -1  'True
            TabAction       =   2
            FormatLocked    =   -1  'True
            AllowDelete     =   -1  'True
            BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            ColumnCount     =   8
            BeginProperty Column00 
               DataField       =   "cItemType"
               Caption         =   "Product Type"
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   0
                  Format          =   ""
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   0
               EndProperty
            EndProperty
            BeginProperty Column01 
               DataField       =   "cItemNo"
               Caption         =   "Product ID"
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   0
                  Format          =   "0.00"
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   0
               EndProperty
            EndProperty
            BeginProperty Column02 
               DataField       =   "cDesc"
               Caption         =   "Description"
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   0
                  Format          =   ""
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   0
               EndProperty
            EndProperty
            BeginProperty Column03 
               DataField       =   "cUnit"
               Caption         =   "Unit"
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   0
                  Format          =   "0"
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   0
               EndProperty
            EndProperty
            BeginProperty Column04 
               DataField       =   "nQty"
               Caption         =   "Quantity"
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   1
                  Format          =   "#,##0.00"
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   1
               EndProperty
            EndProperty
            BeginProperty Column05 
               DataField       =   "nCost"
               Caption         =   "Cost"
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   1
                  Format          =   "#,##0.00"
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   0
               EndProperty
            EndProperty
            BeginProperty Column06 
               DataField       =   "nAmount"
               Caption         =   "Amount"
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   1
                  Format          =   "#,##0.00"
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   0
               EndProperty
            EndProperty
            BeginProperty Column07 
               DataField       =   "cRemarks"
               Caption         =   "Remarks"
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   0
                  Format          =   ""
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   0
               EndProperty
            EndProperty
            SplitCount      =   1
            BeginProperty Split0 
               BeginProperty Column00 
                  Button          =   -1  'True
                  Locked          =   -1  'True
                  ColumnWidth     =   1230.236
               EndProperty
               BeginProperty Column01 
                  Button          =   -1  'True
                  ColumnWidth     =   1409.953
               EndProperty
               BeginProperty Column02 
                  Locked          =   -1  'True
                  ColumnWidth     =   2684.977
               EndProperty
               BeginProperty Column03 
                  Locked          =   -1  'True
                  ColumnWidth     =   675.213
               EndProperty
               BeginProperty Column04 
                  Alignment       =   1
                  ColumnWidth     =   1124.787
               EndProperty
               BeginProperty Column05 
                  Alignment       =   1
                  ColumnWidth     =   1094.74
               EndProperty
               BeginProperty Column06 
                  Alignment       =   1
                  Locked          =   -1  'True
                  ColumnWidth     =   1275.024
               EndProperty
               BeginProperty Column07 
                  ColumnWidth     =   2700.284
               EndProperty
            EndProperty
         End
         Begin VB.ComboBox cboParts 
            Height          =   315
            ItemData        =   "frmEnhanceWorkOrder.frx":0000
            Left            =   120
            List            =   "frmEnhanceWorkOrder.frx":000D
            Style           =   2  'Dropdown List
            TabIndex        =   43
            Top             =   2040
            Visible         =   0   'False
            Width           =   1035
         End
         Begin VB.ComboBox cboBuyout 
            Height          =   315
            ItemData        =   "frmEnhanceWorkOrder.frx":0027
            Left            =   -74850
            List            =   "frmEnhanceWorkOrder.frx":0034
            Style           =   2  'Dropdown List
            TabIndex        =   42
            Top             =   1980
            Visible         =   0   'False
            Width           =   1035
         End
         Begin MSDataGridLib.DataGrid dtgLabor 
            Height          =   2520
            Left            =   -75000
            TabIndex        =   41
            Top             =   315
            Width           =   13635
            _ExtentX        =   24051
            _ExtentY        =   4445
            _Version        =   393216
            AllowUpdate     =   -1  'True
            AllowArrows     =   -1  'True
            BackColor       =   16777215
            HeadLines       =   1
            RowHeight       =   15
            TabAcrossSplits =   -1  'True
            TabAction       =   2
            FormatLocked    =   -1  'True
            AllowDelete     =   -1  'True
            BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            ColumnCount     =   6
            BeginProperty Column00 
               DataField       =   "cEmpCode"
               Caption         =   "Employee Code"
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   0
                  Format          =   "0.00"
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   0
               EndProperty
            EndProperty
            BeginProperty Column01 
               DataField       =   "cEmpName"
               Caption         =   "Employee Name"
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   0
                  Format          =   ""
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   0
               EndProperty
            EndProperty
            BeginProperty Column02 
               DataField       =   "nHours"
               Caption         =   "# of Hours"
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   1
                  Format          =   "#,##0.00"
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   1
               EndProperty
            EndProperty
            BeginProperty Column03 
               DataField       =   "nCostPerHour"
               Caption         =   "Labor Cost per Hour"
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   1
                  Format          =   "#,##0.00"
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   0
               EndProperty
            EndProperty
            BeginProperty Column04 
               DataField       =   "nAmount"
               Caption         =   "Amount"
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   1
                  Format          =   "#,##0.00"
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   0
               EndProperty
            EndProperty
            BeginProperty Column05 
               DataField       =   "cRemarks"
               Caption         =   "Remarks"
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   0
                  Format          =   ""
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   0
               EndProperty
            EndProperty
            SplitCount      =   1
            BeginProperty Split0 
               BeginProperty Column00 
                  Button          =   -1  'True
                  ColumnWidth     =   1574.929
               EndProperty
               BeginProperty Column01 
                  Locked          =   -1  'True
                  ColumnWidth     =   3449.764
               EndProperty
               BeginProperty Column02 
                  Alignment       =   1
                  ColumnWidth     =   1094.74
               EndProperty
               BeginProperty Column03 
                  Alignment       =   1
                  ColumnWidth     =   1604.976
               EndProperty
               BeginProperty Column04 
                  Alignment       =   1
                  Locked          =   -1  'True
                  ColumnWidth     =   1544.882
               EndProperty
               BeginProperty Column05 
                  ColumnWidth     =   2894.74
               EndProperty
            EndProperty
         End
      End
   End
   Begin ITGControls.ITGTab SSTab1 
      Height          =   7140
      Left            =   0
      TabIndex        =   0
      Top             =   0
      Width           =   13635
      _ExtentX        =   24051
      _ExtentY        =   12594
      TabCount        =   2
      TabCaption(0)   =   "               Main               "
      TabContCtrlCnt(0)=   1
      Tab(0)ContCtrlCap(1)=   "ComunionFrames1"
      TabCaption(1)   =   "               List               "
      TabContCtrlCnt(1)=   1
      Tab(1)ContCtrlCap(1)=   "dtgList"
      TabTheme        =   2
      ActiveTabBackStartColor=   16250865
      ActiveTabBackEndColor=   16243138
      InActiveTabBackStartColor=   16243138
      InActiveTabBackEndColor=   16243138
      BeginProperty ActiveTabFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      BeginProperty InActiveTabFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      OuterBorderColor=   4210752
      TopLeftInnerBorderColor=   4210752
      BottomRightInnerBorderColor=   4210752
      DisabledTabBackColor=   16243138
      DisabledTabForeColor=   -2147483630
      Begin MSDataGridLib.DataGrid dtgList 
         Height          =   3585
         Left            =   -75000
         TabIndex        =   39
         Top             =   315
         Width           =   13635
         _ExtentX        =   24051
         _ExtentY        =   6324
         _Version        =   393216
         AllowUpdate     =   0   'False
         AllowArrows     =   -1  'True
         Appearance      =   0
         HeadLines       =   1
         RowHeight       =   15
         TabAction       =   2
         FormatLocked    =   -1  'True
         BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ColumnCount     =   5
         BeginProperty Column00 
            DataField       =   "cTranNo"
            Caption         =   "Work Order No."
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column01 
            DataField       =   "dDate"
            Caption         =   "Date"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   1
               Format          =   "MM/dd/yyyy"
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   3
            EndProperty
         EndProperty
         BeginProperty Column02 
            DataField       =   "cRefJONo"
            Caption         =   "Refence JO No."
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   "MM/dd/yyyy"
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column03 
            DataField       =   "dActualStart"
            Caption         =   "Actual Date Started"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   1
               Format          =   "MM/dd/yyyy"
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column04 
            DataField       =   "dActualFinish"
            Caption         =   "Actual Date Finished"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   1
               Format          =   "MM/dd/yyyy"
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   3
            EndProperty
         EndProperty
         SplitCount      =   1
         BeginProperty Split0 
            AllowRowSizing  =   0   'False
            BeginProperty Column00 
               ColumnAllowSizing=   -1  'True
               Locked          =   -1  'True
               ColumnWidth     =   1500.095
            EndProperty
            BeginProperty Column01 
               Locked          =   -1  'True
               ColumnWidth     =   1500.095
            EndProperty
            BeginProperty Column02 
               Locked          =   -1  'True
               ColumnWidth     =   1500.095
            EndProperty
            BeginProperty Column03 
               Locked          =   -1  'True
               ColumnWidth     =   1604.976
            EndProperty
            BeginProperty Column04 
               Locked          =   -1  'True
               ColumnWidth     =   1604.976
            EndProperty
         EndProperty
      End
      Begin ITGControls.ComunionFrames ComunionFrames1 
         Height          =   3585
         Left            =   0
         Top             =   315
         Width           =   13635
         _ExtentX        =   24051
         _ExtentY        =   6324
         FrameColor      =   4210752
         BackColor       =   16243138
         FillColor       =   16243138
         RoundedCorner   =   0   'False
         Caption         =   "Work Order Information"
         Alignment       =   0
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ThemeColor      =   5
         ColorFrom       =   16243138
         ColorTo         =   16250865
         Begin VB.Timer Timer1 
            Interval        =   300
            Left            =   3525
            Top             =   525
         End
         Begin VB.CommandButton cmdPickJONo 
            Height          =   300
            Left            =   3135
            Picture         =   "frmEnhanceWorkOrder.frx":004E
            Style           =   1  'Graphical
            TabIndex        =   5
            Top             =   840
            Width           =   315
         End
         Begin VB.CommandButton cmdPickPC 
            Height          =   300
            Left            =   3135
            Picture         =   "frmEnhanceWorkOrder.frx":0198
            Style           =   1  'Graphical
            TabIndex        =   16
            Top             =   2100
            Width           =   315
         End
         Begin ITGControls.ITGTab SSTab2 
            Height          =   2055
            Left            =   7245
            TabIndex        =   31
            Top             =   1170
            Width           =   6090
            _ExtentX        =   10742
            _ExtentY        =   3625
            TabCount        =   4
            TabCaption(0)   =   "     Equipment     "
            TabContCtrlCnt(0)=   3
            Tab(0)ContCtrlCap(1)=   "txtLocation"
            Tab(0)ContCtrlCap(2)=   "txtMarks"
            Tab(0)ContCtrlCap(3)=   "txtCategory"
            TabCaption(1)   =   "     Vehicle     "
            TabContCtrlCnt(1)=   6
            Tab(1)ContCtrlCap(1)=   "txtVehicleType"
            Tab(1)ContCtrlCap(2)=   "txtVehicleMake"
            Tab(1)ContCtrlCap(3)=   "txtVehicleModel"
            Tab(1)ContCtrlCap(4)=   "txtVehicleDesc"
            Tab(1)ContCtrlCap(5)=   "txtVehiclePlateNo"
            Tab(1)ContCtrlCap(6)=   "txtVehicleKM"
            TabCaption(2)   =   "     Vessel     "
            TabContCtrlCnt(2)=   3
            Tab(2)ContCtrlCap(1)=   "txtVesselNo"
            Tab(2)ContCtrlCap(2)=   "txtVesselEngine"
            Tab(2)ContCtrlCap(3)=   "txtVesselName"
            TabCaption(3)   =   "     Others     "
            TabTheme        =   2
            ActiveTabBackStartColor=   16250865
            ActiveTabBackEndColor=   16243138
            InActiveTabBackStartColor=   16250865
            InActiveTabBackEndColor=   16243138
            BeginProperty ActiveTabFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            BeginProperty InActiveTabFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            OuterBorderColor=   4210752
            TopLeftInnerBorderColor=   4210752
            BottomRightInnerBorderColor=   4210752
            DisabledTabBackColor=   16243138
            DisabledTabForeColor=   -2147483630
            Begin ITGControls.ITGTextBox txtLocation 
               Height          =   285
               Left            =   240
               TabIndex        =   21
               TabStop         =   0   'False
               Top             =   1170
               Width           =   5385
               _ExtentX        =   9287
               _ExtentY        =   503
               SendKeysTab     =   -1  'True
               BackColor       =   14737632
               LabelBackColor  =   16243138
               BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               AllCaps         =   -1  'True
               Label           =   "Location"
               BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               TextBoxWidth    =   3825
               Enabled         =   0   'False
            End
            Begin ITGControls.ITGTextBox txtMarks 
               Height          =   285
               Left            =   240
               TabIndex        =   20
               TabStop         =   0   'False
               Top             =   855
               Width           =   5385
               _ExtentX        =   9287
               _ExtentY        =   503
               SendKeysTab     =   -1  'True
               BackColor       =   14737632
               LabelBackColor  =   16243138
               BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               AllCaps         =   -1  'True
               Label           =   "Marks"
               BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               TextBoxWidth    =   3825
               Enabled         =   0   'False
            End
            Begin ITGControls.ITGTextBox txtCategory 
               Height          =   285
               Left            =   240
               TabIndex        =   19
               TabStop         =   0   'False
               Top             =   540
               Width           =   5385
               _ExtentX        =   9287
               _ExtentY        =   503
               SendKeysTab     =   -1  'True
               BackColor       =   14737632
               LabelBackColor  =   16243138
               BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               AllCaps         =   -1  'True
               Label           =   "Category"
               BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               TextBoxWidth    =   3825
               Enabled         =   0   'False
            End
            Begin ITGControls.ITGTextBox txtVehicleType 
               Height          =   285
               Left            =   -74775
               TabIndex        =   22
               TabStop         =   0   'False
               Top             =   510
               Width           =   2580
               _ExtentX        =   4339
               _ExtentY        =   503
               SendKeysTab     =   -1  'True
               BackColor       =   14737632
               LabelBackColor  =   16243138
               BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               AllCaps         =   -1  'True
               Label           =   "Vehicle Type"
               BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               LabelWidth      =   1140
               TextBoxWidth    =   1380
               Enabled         =   0   'False
            End
            Begin ITGControls.ITGTextBox txtVehicleMake 
               Height          =   285
               Left            =   -74775
               TabIndex        =   24
               TabStop         =   0   'False
               Top             =   825
               Width           =   2580
               _ExtentX        =   4339
               _ExtentY        =   503
               SendKeysTab     =   -1  'True
               BackColor       =   14737632
               LabelBackColor  =   16243138
               BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               AllCaps         =   -1  'True
               Label           =   "Make"
               BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               LabelWidth      =   1140
               TextBoxWidth    =   1380
               Enabled         =   0   'False
            End
            Begin ITGControls.ITGTextBox txtVehicleModel 
               Height          =   285
               Left            =   -74775
               TabIndex        =   26
               TabStop         =   0   'False
               Top             =   1140
               Width           =   2580
               _ExtentX        =   4339
               _ExtentY        =   503
               SendKeysTab     =   -1  'True
               BackColor       =   14737632
               LabelBackColor  =   16243138
               BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               AllCaps         =   -1  'True
               Label           =   "Model"
               BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               LabelWidth      =   1140
               TextBoxWidth    =   1380
               Enabled         =   0   'False
            End
            Begin ITGControls.ITGTextBox txtVehicleDesc 
               Height          =   285
               Left            =   -71955
               TabIndex        =   23
               TabStop         =   0   'False
               Top             =   510
               Width           =   2580
               _ExtentX        =   4339
               _ExtentY        =   503
               SendKeysTab     =   -1  'True
               BackColor       =   14737632
               LabelBackColor  =   16243138
               BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               AllCaps         =   -1  'True
               Label           =   "Description"
               BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               LabelWidth      =   1140
               TextBoxWidth    =   1380
               Enabled         =   0   'False
            End
            Begin ITGControls.ITGTextBox txtVehiclePlateNo 
               Height          =   285
               Left            =   -71955
               TabIndex        =   25
               TabStop         =   0   'False
               Top             =   825
               Width           =   2580
               _ExtentX        =   4339
               _ExtentY        =   503
               SendKeysTab     =   -1  'True
               BackColor       =   14737632
               LabelBackColor  =   16243138
               BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               AllCaps         =   -1  'True
               Label           =   "Plate No."
               BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               LabelWidth      =   1140
               TextBoxWidth    =   1380
               Enabled         =   0   'False
            End
            Begin ITGControls.ITGTextBox txtVehicleKM 
               Height          =   285
               Left            =   -73755
               TabIndex        =   27
               Top             =   1680
               Width           =   2940
               _ExtentX        =   4974
               _ExtentY        =   503
               SendKeysTab     =   -1  'True
               LabelBackColor  =   16243138
               BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               Text            =   "0"
               DataType        =   1
               Label           =   "Kilometer Reading"
               BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               TextBoxWidth    =   1380
            End
            Begin ITGControls.ITGTextBox txtVesselNo 
               Height          =   285
               Left            =   -74700
               TabIndex        =   28
               TabStop         =   0   'False
               Top             =   555
               Width           =   3105
               _ExtentX        =   5265
               _ExtentY        =   503
               SendKeysTab     =   -1  'True
               BackColor       =   14737632
               LabelBackColor  =   16243138
               BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               AllCaps         =   -1  'True
               Label           =   "Vessel No."
               BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               TextBoxWidth    =   1545
               Enabled         =   0   'False
            End
            Begin ITGControls.ITGTextBox txtVesselEngine 
               Height          =   285
               Left            =   -74700
               TabIndex        =   30
               TabStop         =   0   'False
               Top             =   1185
               Width           =   5445
               _ExtentX        =   9393
               _ExtentY        =   503
               SendKeysTab     =   -1  'True
               BackColor       =   14737632
               LabelBackColor  =   16243138
               BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               AllCaps         =   -1  'True
               Label           =   "Vessel Engine"
               BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               TextBoxWidth    =   3885
               Enabled         =   0   'False
            End
            Begin ITGControls.ITGTextBox txtVesselName 
               Height          =   285
               Left            =   -74700
               TabIndex        =   29
               TabStop         =   0   'False
               Top             =   870
               Width           =   5445
               _ExtentX        =   9393
               _ExtentY        =   503
               SendKeysTab     =   -1  'True
               BackColor       =   14737632
               LabelBackColor  =   16243138
               BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               AllCaps         =   -1  'True
               Label           =   "Vessel Name"
               BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               TextBoxWidth    =   3885
               Enabled         =   0   'False
            End
         End
         Begin ITGControls.ITGTextBox txtTranNo 
            Height          =   285
            Left            =   150
            TabIndex        =   1
            Top             =   525
            Width           =   2970
            _ExtentX        =   5027
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            BackColor       =   14745599
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            AllCaps         =   -1  'True
            Mandatory       =   -1  'True
            Label           =   "Work Order No."
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            TextBoxWidth    =   1410
            Required        =   -1  'True
         End
         Begin ITGControls.ITGDateBox dtbDate 
            Height          =   285
            Left            =   5550
            TabIndex        =   2
            Tag             =   "Transaction Date"
            Top             =   525
            Width           =   1410
            _ExtentX        =   2487
            _ExtentY        =   503
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Text            =   ""
            SendKeysTab     =   -1  'True
            Mandatory       =   -1  'True
         End
         Begin ITGControls.ITGTextBox txtDeptDesc 
            Height          =   285
            Left            =   3090
            TabIndex        =   10
            TabStop         =   0   'False
            Top             =   1155
            Width           =   3870
            _ExtentX        =   6720
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            BackColor       =   14737632
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            AllCaps         =   -1  'True
            Label           =   "ITGtext"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   0
            TextBoxWidth    =   3810
            Enabled         =   0   'False
         End
         Begin ITGControls.ITGTextBox txtDeptID 
            Height          =   285
            Left            =   150
            TabIndex        =   9
            TabStop         =   0   'False
            Top             =   1155
            Width           =   2955
            _ExtentX        =   5001
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            BackColor       =   14737632
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            AllCaps         =   -1  'True
            Label           =   "Department"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            TextBoxWidth    =   1395
            Enabled         =   0   'False
         End
         Begin ITGControls.ITGTextBox txtRefJONo 
            Height          =   285
            Left            =   150
            TabIndex        =   4
            Top             =   840
            Width           =   2955
            _ExtentX        =   5001
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            AllCaps         =   -1  'True
            Label           =   "Job Order No."
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            TextBoxWidth    =   1395
            Required        =   -1  'True
         End
         Begin ITGControls.ITGTextBox txtService 
            Height          =   285
            Left            =   5520
            TabIndex        =   6
            TabStop         =   0   'False
            Top             =   840
            Width           =   1440
            _ExtentX        =   2434
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            BackColor       =   14737632
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            AllCaps         =   -1  'True
            Label           =   "ITGtext"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   0
            TextBoxWidth    =   1380
            Enabled         =   0   'False
         End
         Begin ITGControls.ITGDateBox dtbEstToStart 
            Height          =   285
            Left            =   1680
            TabIndex        =   11
            TabStop         =   0   'False
            Tag             =   "Transaction Date"
            Top             =   1455
            Width           =   1440
            _ExtentX        =   2540
            _ExtentY        =   503
            BackColor       =   14737632
            Enabled         =   0   'False
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Text            =   ""
            SendKeysTab     =   -1  'True
            Mandatory       =   -1  'True
            BackColor       =   14737632
         End
         Begin ITGControls.ITGDateBox dtbEstToFinish 
            Height          =   285
            Left            =   1680
            TabIndex        =   13
            TabStop         =   0   'False
            Tag             =   "Transaction Date"
            Top             =   1785
            Width           =   1440
            _ExtentX        =   2540
            _ExtentY        =   503
            BackColor       =   14737632
            Enabled         =   0   'False
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Text            =   ""
            SendKeysTab     =   -1  'True
            Mandatory       =   -1  'True
            BackColor       =   14737632
         End
         Begin ITGControls.ITGDateBox dtbStarted 
            Height          =   285
            Left            =   5505
            TabIndex        =   12
            Tag             =   "Transaction Date"
            Top             =   1470
            Width           =   1455
            _ExtentX        =   2566
            _ExtentY        =   503
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Text            =   ""
            SendKeysTab     =   -1  'True
            Mandatory       =   -1  'True
         End
         Begin ITGControls.ITGDateBox dtbFinished 
            Height          =   285
            Left            =   5505
            TabIndex        =   14
            Tag             =   "Transaction Date"
            Top             =   1785
            Width           =   1455
            _ExtentX        =   2566
            _ExtentY        =   503
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Text            =   ""
            SendKeysTab     =   -1  'True
            Mandatory       =   -1  'True
         End
         Begin ITGControls.ITGTextBox txtAssetDesc 
            Height          =   285
            Left            =   9810
            TabIndex        =   8
            TabStop         =   0   'False
            Top             =   840
            Width           =   3300
            _ExtentX        =   5715
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            BackColor       =   14737632
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            AllCaps         =   -1  'True
            Label           =   "ITGtext"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   0
            TextBoxWidth    =   3240
            Enabled         =   0   'False
         End
         Begin ITGControls.ITGTextBox txtAssetID 
            Height          =   285
            Left            =   7230
            TabIndex        =   7
            TabStop         =   0   'False
            Top             =   840
            Width           =   2565
            _ExtentX        =   4313
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            BackColor       =   14737632
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            AllCaps         =   -1  'True
            Label           =   "Asset"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   1400
            TextBoxWidth    =   1105
            Enabled         =   0   'False
         End
         Begin ITGControls.ITGTextBox txtAssetType 
            Height          =   285
            Left            =   7230
            TabIndex        =   3
            TabStop         =   0   'False
            Top             =   525
            Width           =   2565
            _ExtentX        =   4313
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            BackColor       =   14737632
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            AllCaps         =   -1  'True
            Label           =   "Asset Type"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   1400
            TextBoxWidth    =   1105
            Enabled         =   0   'False
         End
         Begin ITGControls.ITGTextBox txtPCDesc 
            Height          =   285
            Left            =   3465
            TabIndex        =   17
            TabStop         =   0   'False
            Top             =   2100
            Width           =   3480
            _ExtentX        =   6033
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            BackColor       =   14737632
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            AllCaps         =   -1  'True
            Label           =   "ITGtext"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   0
            TextBoxWidth    =   3420
            Enabled         =   0   'False
         End
         Begin ITGControls.ITGTextBox txtPCCode 
            Height          =   285
            Left            =   150
            TabIndex        =   15
            Top             =   2100
            Width           =   2970
            _ExtentX        =   5027
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            BackColor       =   14745599
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            AllCaps         =   -1  'True
            Mandatory       =   -1  'True
            Label           =   "Division"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            TextBoxWidth    =   1410
            Required        =   -1  'True
            LinkForeColor   =   0
         End
         Begin VB.Label Label6 
            AutoSize        =   -1  'True
            BackStyle       =   0  'Transparent
            Caption         =   "Service"
            Height          =   195
            Left            =   4530
            TabIndex        =   37
            Top             =   1155
            Width           =   525
         End
         Begin VB.Label Label5 
            AutoSize        =   -1  'True
            BackStyle       =   0  'Transparent
            Caption         =   "Actual Date Finished"
            Height          =   195
            Left            =   3615
            TabIndex        =   36
            Top             =   1785
            Width           =   1470
         End
         Begin VB.Label Label4 
            AutoSize        =   -1  'True
            BackStyle       =   0  'Transparent
            Caption         =   "Actual Date Started"
            Height          =   195
            Left            =   3615
            TabIndex        =   35
            Top             =   1470
            Width           =   1425
         End
         Begin VB.Label Label3 
            AutoSize        =   -1  'True
            BackStyle       =   0  'Transparent
            Caption         =   "Est. Date to Start"
            Height          =   195
            Left            =   180
            TabIndex        =   34
            Top             =   1500
            Width           =   1275
         End
         Begin VB.Label Label2 
            AutoSize        =   -1  'True
            BackStyle       =   0  'Transparent
            Caption         =   "Est. Date to Finish"
            Height          =   195
            Left            =   180
            TabIndex        =   33
            Top             =   1830
            Width           =   1320
         End
         Begin VB.Label Label1 
            AutoSize        =   -1  'True
            BackStyle       =   0  'Transparent
            Caption         =   "Date"
            Height          =   195
            Left            =   4920
            TabIndex        =   32
            Top             =   570
            Width           =   345
         End
      End
   End
End
Attribute VB_Name = "frmEnhanceWorkOrder"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'IT Group Inc. 2005.09.23

Option Explicit

'Object variables




Private oPrint As New clsPrinting

'Recordset variables
Private WithEvents rsHeader As ADODB.Recordset
Attribute rsHeader.VB_VarHelpID = -1
Private rsParts As ADODB.Recordset
Private rsBuyout As ADODB.Recordset
Private rsLabor As ADODB.Recordset

'ADO Connection variables

Private connHeader As ADODB.Connection
Private connParts As ADODB.Connection
Private connBuyout As ADODB.Connection
Private connLabor As ADODB.Connection

'Form mode enumeration
Enum eWOMode
    Normal
    AddNewEdit
    Find
End Enum
Public Mode As eWOMode

'Other declarations
Public dtgName As String
Public sBit As String
Private vBM As Variant 'Recordset bookmark variable

Private lSystemGenerated As Boolean
Public strNo As String

'Security Acess Level variables
Public lACNew As Boolean
Public lACEdit As Boolean
Public lACDelete As Boolean
Public lACPost As Boolean
Public lACCancel As Boolean
Public lACPrint As Boolean

Private Sub cboBuyout_Click()
    rsBuyout!cItemType = cboBuyout
End Sub

Private Sub cboBuyout_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = 13 Then
        If dtgBuyout.Col = 0 Then
            rsBuyout!cItemType = cboBuyout
            cboBuyout.Visible = False
            dtgBuyout.Col = 1
            dtgBuyout.SetFocus
        End If
    ElseIf KeyCode = vbKeyEscape Then
        cboBuyout.Visible = False
    End If
End Sub

Private Sub cboBuyout_LostFocus()
    cboBuyout.Visible = False
End Sub

Private Sub cboParts_Click()
    rsParts!cItemType = cboParts
End Sub

Private Sub cboParts_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = 13 Then
        If dtgParts.Col = 0 Then
            rsParts!cItemType = cboParts
            cboParts.Visible = False
            dtgParts.Col = 1
            dtgParts.SetFocus
        End If
    ElseIf KeyCode = vbKeyEscape Then
        cboParts.Visible = False
    End If
End Sub

Private Sub cboParts_LostFocus()
    cboParts.Visible = False
End Sub

Private Sub cmdPickPC_Click()
    If lPickListActive Then Exit Sub
    sFilterString = Trim(txtPCCode)
    frmITGPicker.zType = QProfitCenter
    frmITGPicker.Show vbModal
    txtPCCode = frmITGPicker.zCode
    txtPCDesc = frmITGPicker.zName
    If Trim(txtPCDesc) <> "" Then SendKeys "{Tab}"
End Sub

Private Sub cmdPickJONo_Click()
    'If Mode <> AddNewEdit Then Exit Sub
    frmEnhanceJOList.mTranType = JOForWO
    frmEnhanceJOList.Show vbModal
    If Trim(txtRefJONo) <> "" Then SendKeys "{Tab}"
End Sub

Private Sub dtbFinished_LostFocus()
    If Mode <> AddNewEdit Then Exit Sub
    If rsParts.RecordCount < 1 Then
        dtgName = dtgParts.Name
        TBNewLine
    End If
End Sub

Private Sub dtgBuyout_AfterColUpdate(ByVal ColIndex As Integer)
    
    If Mode <> AddNewEdit Then Exit Sub
    Select Case ColIndex
        Case 1
            If Trim(dtgBuyout.Columns(0).Text) = "Trade" Then
                If GetValueFrTable("cItemNo", "ITEM", "cItemNo = '" & Trim(dtgBuyout.Columns(1).Value) & "'") <> "" Then
                    GetInitialItemValues rsBuyout
                    dtgBuyout.Col = 4
                    dtgBuyout.Columns(4).Value = 0
                End If
            ElseIf Trim(dtgBuyout.Columns(0).Text) = "Asset" Then
                If GetValueFrTable("cAssetNo", "ASSET", "cAssetNo = '" & Trim(dtgBuyout.Columns(1).Value) & "'") <> "" Then
                    'GetInitialItemValues rsBuyout
                    dtgBuyout.Col = 4
                    dtgBuyout.Columns(4).Value = 0
                End If
            ElseIf Trim(dtgBuyout.Columns(0).Text) = "Supply" Then
                If GetValueFrTable("cSupplyNo", "SUPPLY", "cSupplyNo = '" & Trim(dtgBuyout.Columns(1).Value) & "'") <> "" Then
                    dtgBuyout.Col = 4
                    dtgBuyout.Columns(4).Value = 0
                End If
            End If
        Case 4
            ComputeAmount rsBuyout, dtgBuyout.Name
        Case 5
            ComputeAmount rsBuyout, dtgBuyout.Name
    End Select
    
End Sub

Private Sub dtgBuyout_ButtonClick(ByVal ColIndex As Integer)

    If Mode <> AddNewEdit Then Exit Sub
    Select Case ColIndex
        Case 0
            Call MoveCombo(cboBuyout, dtgBuyout, dtgBuyout.Columns(0))
            ComboLoadValue cboBuyout, Trim(dtgBuyout.Columns(0).Text)
        Case 1
            If dtgBuyout.Columns(0).Text = "" Then
                Exit Sub
            ElseIf dtgBuyout.Columns(0).Text = "Trade" Then
                If lPickListActive Then Exit Sub
                sFilterString = Trim(dtgBuyout.Columns(1).Text)
                frmITGPickList.mType = Product
                frmITGPickList.Show vbModal
                rsBuyout!cItemNo = Trim(frmITGPickList.mCode) & ""
                If (Trim(frmITGPickList.mName) & "") <> "" Then
                    GetInitialItemValues rsBuyout
                    dtgBuyout.Col = 4
                    dtgBuyout.Columns(4).Value = 0
                End If
            ElseIf dtgBuyout.Columns(0).Text = "Asset" Then
                If lPickListActive Then Exit Sub
                sFilterString = Trim(dtgBuyout.Columns(1).Text)
                frmITGPickList.mType = Asset
                frmITGPickList.Show vbModal
                rsBuyout!cItemNo = Trim(frmITGPickList.mCode) & ""
                If (Trim(frmITGPickList.mName) & "") <> "" Then
                    GetInitialAssetValues rsBuyout
                    dtgBuyout.Col = 4
                    dtgBuyout.Columns(4).Value = 0
                End If
            ElseIf dtgBuyout.Columns(0).Text = "Supply" Then
                If lPickListActive Then Exit Sub
                sFilterString = Trim(dtgBuyout.Columns(1).Text)
                frmITGPickList.mType = Supply
                frmITGPickList.Show vbModal
                rsBuyout!cItemNo = Trim(frmITGPickList.mCode) & ""
                If (Trim(frmITGPickList.mName) & "") <> "" Then
                    GetInitialSupplyValues rsBuyout
                    dtgBuyout.Col = 4
                    dtgBuyout.Columns(4).Value = 0
                End If
            End If
    End Select

End Sub

'Set the datagrid as active control
Private Sub dtgBuyout_Click()
    If Mode = AddNewEdit Then dtgName = dtgBuyout.Name
End Sub

Private Sub dtgBuyout_Error(ByVal DataError As Integer, Response As Integer)
    Response = 0
End Sub

Private Sub dtgBuyout_GotFocus()
    dtgName = dtgBuyout.Name
End Sub

Private Sub dtgBuyout_KeyDown(KeyCode As Integer, Shift As Integer)
    If Mode <> AddNewEdit Then Exit Sub
    If (Shift = vbCtrlMask And KeyCode = 45) Then
        TBNewLine
    ElseIf (Shift = vbCtrlMask And KeyCode = 46) Then
        TBDeleteLine
    ElseIf (Shift = vbCtrlMask And KeyCode = 83) Then
        TBSave
    End If
End Sub

Private Sub dtgBuyout_KeyPress(KeyAscii As Integer)
    
    If Mode <> AddNewEdit Then Exit Sub
    If rsBuyout.RecordCount = 0 Then Exit Sub
    
    If KeyAscii = 39 Then KeyAscii = 0 'Apostrophe {'}
    
    If KeyAscii = 13 Then
        Select Case dtgBuyout.Col
            Case 0
                If Not cboBuyout.Visible Then dtgBuyout_ButtonClick (0)
            Case 1
                If dtgBuyout.Columns(0).Text = "Trade" Then
                    If GetValueFrTable("cItemNo", "ITEM", "cItemNo = '" & Trim(dtgBuyout.Columns(1).Value) & "'") = "" Then
                        If Trim(dtgBuyout.Columns(0).Text) = "Trade" Then dtgBuyout_ButtonClick (1)                      'use button click
                    End If
                ElseIf dtgBuyout.Columns(0).Text = "Asset" Then
                    If GetValueFrTable("cAssetNo", "ASSET", "cAssetNo = '" & Trim(dtgBuyout.Columns(1).Value) & "'") = "" Then
                        If Trim(dtgBuyout.Columns(0).Text) = "Asset" Then dtgBuyout_ButtonClick (1)                      'use button click
                    End If
                ElseIf dtgBuyout.Columns(0).Text = "Supply" Then
                    If GetValueFrTable("cSupplyNo", "SUPPLY", "cSupplyNo = '" & Trim(dtgBuyout.Columns(1).Value) & "'") = "" Then
                        If Trim(dtgBuyout.Columns(0).Text) = "Supply" Then dtgBuyout_ButtonClick (1)                      'use button click
                    End If
                End If
            Case 5
                SendKeys "{Tab}"
                SendKeys "{Tab}"
            Case 7
                TBNewLine
                dtgBuyout.LeftCol = 0
            Case Else
                SendKeys "{Tab}"
        End Select
    Else
        KeyAscii = Asc(UCase(Chr(KeyAscii))) 'All Upper Case String
    End If

End Sub

'Right click menu popup
Private Sub dtgBuyout_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Mode <> AddNewEdit Then Exit Sub
    If Button = 2 Then
        dtgName = dtgBuyout.Name
        PopupMenu ITGLedgerMain.mnuDetail
    End If
End Sub

Private Sub dtgBuyout_RowColChange(LastRow As Variant, ByVal LastCol As Integer)
On Error Resume Next
    If Mode <> AddNewEdit Then Exit Sub
    
    'If Trim(dtgBuyout.Columns(0).Text) = "New" Then
    '    dtgBuyout.Columns(2).Locked = False
    '    dtgBuyout.Columns(3).Locked = False
    'Else
    '    dtgBuyout.Columns(2).Locked = True
    '    dtgBuyout.Columns(3).Locked = True
    'End If
End Sub

Private Sub dtgLabor_AfterColUpdate(ByVal ColIndex As Integer)
    If Mode <> AddNewEdit Then Exit Sub
    Select Case ColIndex
        Case 0
            If GetValueFrTable("cEmpCode", "EMPLOYEE", "cEmpCode = '" & Trim(dtgLabor.Columns(0).Value) & "'") <> "" Then
                rsLabor!cEmpName = GetValueFrTable("cEmpName", "EMPLOYEE", "cEmpCode = '" & Trim(dtgLabor.Columns(0).Value) & "'")
                dtgLabor.Col = 2
            End If
        Case 2
            ComputeAmount rsLabor, dtgLabor.Name
        Case 3
            ComputeAmount rsLabor, dtgLabor.Name
    End Select
End Sub

Private Sub dtgLabor_ButtonClick(ByVal ColIndex As Integer)
    If Mode <> AddNewEdit Then Exit Sub
    Select Case ColIndex
        Case 0
            If lPickListActive Then Exit Sub
            sFilterString = Trim(dtgLabor.Columns(0).Text)
            frmITGPickList.mType = EmployeeList
            frmITGPickList.Show vbModal
            rsLabor!cEmpCode = Trim(frmITGPickList.mCode) & ""
            If (Trim(frmITGPickList.mName) & "") <> "" Then
                rsLabor!cEmpName = frmITGPickList.mName
                dtgLabor.Col = 2
            End If
    End Select

End Sub

'Set the datagrid as active control
Private Sub dtgLabor_Click()
    If Mode = AddNewEdit Then dtgName = dtgLabor.Name
End Sub

Private Sub dtgLabor_Error(ByVal DataError As Integer, Response As Integer)
    Response = 0
End Sub

Private Sub dtgLabor_GotFocus()
    dtgName = dtgLabor.Name
End Sub

Private Sub dtgLabor_KeyDown(KeyCode As Integer, Shift As Integer)
    If Mode <> AddNewEdit Then Exit Sub
    If (Shift = vbCtrlMask And KeyCode = 45) Then
        TBNewLine
    ElseIf (Shift = vbCtrlMask And KeyCode = 46) Then
        TBDeleteLine
    ElseIf (Shift = vbCtrlMask And KeyCode = 83) Then
        TBSave
    End If
End Sub

Private Sub dtgLabor_KeyPress(KeyAscii As Integer)
    
    If Mode <> AddNewEdit Then Exit Sub
    If rsLabor.RecordCount = 0 Then Exit Sub

    If KeyAscii = 39 Then KeyAscii = 0 'Apostrophe {'}

    If KeyAscii = 13 Then
        Select Case dtgLabor.Col
            Case 0
                If GetValueFrTable("cEmpCode", "EMPLOYEE", "cEmpCode = '" & Trim(dtgLabor.Columns(0).Value) & "'") = "" Then
                    dtgLabor_ButtonClick (0)
                End If
            Case 3
                SendKeys "{Tab}"
                SendKeys "{Tab}"
            Case 5
                TBNewLine
                dtgLabor.LeftCol = 0
            Case Else
                SendKeys "{Tab}"
        End Select
    Else
        KeyAscii = Asc(UCase(Chr(KeyAscii))) 'All Upper Case String
    End If

End Sub

'Right click menu popup
Private Sub dtgLabor_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Mode <> AddNewEdit Then Exit Sub
    If Button = 2 Then
        dtgName = dtgLabor.Name
        PopupMenu ITGLedgerMain.mnuDetail
    End If
End Sub

'-------------
Private Sub dtgParts_AfterColUpdate(ByVal ColIndex As Integer)
    
    If Mode <> AddNewEdit Then Exit Sub
    Select Case ColIndex
        Case 1
            If Trim(dtgParts.Columns(0).Text) = "Trade" Then
                If GetValueFrTable("cItemNo", "ITEM", "cItemNo = '" & Trim(dtgParts.Columns(1).Value) & "'") <> "" Then
                    GetInitialItemValues rsParts
                    dtgParts.Col = 4
                    dtgParts.Columns(4).Value = 0
                End If
            ElseIf Trim(dtgParts.Columns(0).Text) = "Asset" Then
                If GetValueFrTable("cAssetNo", "ASSET", "cAssetNo = '" & Trim(dtgParts.Columns(1).Value) & "'") <> "" Then
                    'GetInitialItemValues rsParts
                    dtgParts.Col = 4
                    dtgParts.Columns(4).Value = 0
                End If
            ElseIf Trim(dtgParts.Columns(0).Text) = "Supply" Then
                If GetValueFrTable("cSupplyNo", "SUPPLY", "cSupplyNo = '" & Trim(dtgParts.Columns(1).Value) & "'") <> "" Then
                    dtgParts.Col = 4
                    dtgParts.Columns(4).Value = 0
                End If
            End If
        Case 4
            ComputeAmount rsParts, dtgParts.Name
        Case 5
            ComputeAmount rsParts, dtgParts.Name
    End Select
    
End Sub

Private Sub dtgParts_ButtonClick(ByVal ColIndex As Integer)

If Mode = AddNewEdit Then 'Exit Sub
    Select Case ColIndex
        Case 0
            Call MoveCombo(cboParts, dtgParts, dtgParts.Columns(0))
            ComboLoadValue cboParts, Trim(dtgParts.Columns(0).Text)
        Case 1
            If dtgParts.Columns(0).Text = "" Then
                Exit Sub
            ElseIf dtgParts.Columns(0).Text = "Trade" Then
                If lPickListActive Then Exit Sub
                sFilterString = Trim(dtgParts.Columns(1).Text)
                frmITGPickList.mType = Product
                frmITGPickList.Show vbModal
                rsParts!cItemNo = Trim(frmITGPickList.mCode) & ""
                If (Trim(frmITGPickList.mName) & "") <> "" Then
                    GetInitialItemValues rsParts
                    dtgParts.Col = 4
                    dtgParts.Columns(4).Value = 0
                End If
            ElseIf dtgParts.Columns(0).Text = "Asset" Then
                If lPickListActive Then Exit Sub
                sFilterString = Trim(dtgParts.Columns(1).Text)
                frmITGPickList.mType = Asset
                frmITGPickList.Show vbModal
                rsParts!cItemNo = Trim(frmITGPickList.mCode) & ""
                If (Trim(frmITGPickList.mName) & "") <> "" Then
                    GetInitialAssetValues rsParts
                    dtgParts.Col = 4
                    dtgParts.Columns(4).Value = 0
                End If
            ElseIf dtgParts.Columns(0).Text = "Supply" Then
                If lPickListActive Then Exit Sub
                sFilterString = Trim(dtgParts.Columns(1).Text)
                frmITGPickList.mType = Supply
                frmITGPickList.Show vbModal
                rsParts!cItemNo = Trim(frmITGPickList.mCode) & ""
                If (Trim(frmITGPickList.mName) & "") <> "" Then
                    GetInitialSupplyValues rsParts
                    dtgParts.Col = 4
                    dtgParts.Columns(4).Value = 0
                End If
            End If
    End Select
Else
    Select Case ColIndex
        Case 2
            'If Mode <> Find Then
            '    If Trim(dtgParts.Columns(0).Text) <> "Trade" Then
            '        frmMaintProduct.Show
            '        frmMaintProduct.ZOrder
            '        frmMaintProduct.ShowForm LTrim(RTrim(dtgParts.Columns(2).Text))
            '    End If
            'End If
    End Select
End If

End Sub

'Set the datagrid as active control
Private Sub dtgParts_Click()
    If Mode = AddNewEdit Then dtgName = dtgParts.Name
End Sub

Private Sub dtgParts_Error(ByVal DataError As Integer, Response As Integer)
    Response = 0
End Sub

Private Sub dtgParts_GotFocus()
    dtgName = dtgParts.Name
End Sub

Private Sub dtgParts_KeyDown(KeyCode As Integer, Shift As Integer)
    If Mode <> AddNewEdit Then Exit Sub
    If (Shift = vbCtrlMask And KeyCode = 45) Then
        TBNewLine
    ElseIf (Shift = vbCtrlMask And KeyCode = 46) Then
        TBDeleteLine
    ElseIf (Shift = vbCtrlMask And KeyCode = 83) Then
        TBSave
    End If
End Sub

Private Sub dtgParts_KeyPress(KeyAscii As Integer)
    
    If Mode <> AddNewEdit Then Exit Sub
    If rsParts.RecordCount = 0 Then Exit Sub
    
    If KeyAscii = 39 Then KeyAscii = 0 'Apostrophe {'}
    
    If KeyAscii = 13 Then
        Select Case dtgParts.Col
            Case 0
                If Not cboParts.Visible Then dtgParts_ButtonClick (0)
            Case 1
                If dtgParts.Columns(0).Text = "Trade" Then
                    If GetValueFrTable("cItemNo", "ITEM", "cItemNo = '" & Trim(dtgParts.Columns(1).Value) & "'") = "" Then
                        If Trim(dtgParts.Columns(0).Text) = "Trade" Then dtgParts_ButtonClick (1)                      'use button click
                    End If
                ElseIf dtgParts.Columns(0).Text = "Asset" Then
                    If GetValueFrTable("cAssetNo", "ASSET", "cAssetNo = '" & Trim(dtgParts.Columns(1).Value) & "'") = "" Then
                        If Trim(dtgParts.Columns(0).Text) = "Asset" Then dtgParts_ButtonClick (1)                      'use button click
                    End If
                ElseIf dtgParts.Columns(0).Text = "Supply" Then
                    If GetValueFrTable("cSupplyNo", "SUPPLY", "cSupplyNo = '" & Trim(dtgParts.Columns(1).Value) & "'") = "" Then
                        If Trim(dtgParts.Columns(0).Text) = "Supply" Then dtgParts_ButtonClick (1)                      'use button click
                    End If
                End If
            Case 5
                SendKeys "{Tab}"
                SendKeys "{Tab}"
            Case 7
                TBNewLine
                dtgParts.LeftCol = 0
            Case Else
                SendKeys "{Tab}"
        End Select
    Else
        KeyAscii = Asc(UCase(Chr(KeyAscii))) 'All Upper Case String
    End If

End Sub

'Right click menu popup
Private Sub dtgParts_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Mode <> AddNewEdit Then Exit Sub
    If Button = 2 Then
        dtgName = dtgParts.Name
        PopupMenu ITGLedgerMain.mnuDetail
    End If
End Sub

Private Sub dtgParts_RowColChange(LastRow As Variant, ByVal LastCol As Integer)
On Error Resume Next
    If Mode <> AddNewEdit Then Exit Sub
    
    'If Trim(dtgParts.Columns(0).Text) = "New" Then
    '    dtgParts.Columns(2).Locked = False
    '    dtgParts.Columns(3).Locked = False
    'Else
    '    dtgParts.Columns(2).Locked = True
    '    dtgParts.Columns(3).Locked = True
    'End If
End Sub

Private Sub dtgList_HeadClick(ByVal ColIndex As Integer)
    SortGrid dtgList, ColIndex, rsHeader
End Sub

Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
Dim iKey As Integer
    iKey = ToolbarIndex(KeyCode, Shift)
    If iKey <> 0 Then
        If ITGLedgerMain.tbrMain.Buttons(iKey).Enabled = True Then
            ToolbarFunction iKey
        End If
    End If
End Sub

'Set Your Object
Private Sub Form_Load()
    
    Set FrmName = Me
    FormSetup
    
    AcessBit Me, GetValueFrTable("AccessLevel", "SEC_ACCESSLEVEL", "RoleID = '" & SecUserRole & "' AND [Module] = 'AP01'")
    
    Set rsHeader = New ADODB.Recordset
    Set rsParts = New ADODB.Recordset
    Set rsBuyout = New ADODB.Recordset
    Set rsLabor = New ADODB.Recordset
    
    

    FormLocking True
    FormSearch True
    SearchObj True
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, , , , , , , , , True, , , True
    BitVisible ITGLedgerMain.tbrMain, True, True
    ITGLedgerMain.tbrMain.Buttons("btnFind").ButtonMenus("btnFindP").Enabled = True

    Mode = Find
    txtTranNo.Locked = False
    
   
End Sub

'Activate your Toolbar Mode
Private Sub Form_Activate()
    TBBitReload
End Sub

'Release your Object
Private Sub Form_Unload(Cancel As Integer)
On Error Resume Next
    If Mode = AddNewEdit Then
        MsgBox "Unable to close. You are in Add/New/Edit mode." & vbCr & _
            " Must Save or Undo", vbCritical, Me.Caption
        Cancel = True
        Exit Sub
    End If
    
    CloseMenuTab ITGLedgerMain
    
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, , , , , , , , , , True
    BitVisible ITGLedgerMain.tbrMain
    ITGLedgerMain.tbrMain.Buttons("btnFind").ButtonMenus("btnFindP").Enabled = False

    
    
    
    
    Set oPrint = Nothing
    Set rsHeader = Nothing
    Set rsParts = Nothing
    Set rsBuyout = Nothing
    Set rsLabor = Nothing
    Set connHeader = Nothing
    Set connParts = Nothing
    Set connBuyout = Nothing
    Set connLabor = Nothing
    
    Set frmEnhanceWorkOrder = Nothing

    lCloseWindow = True
    
'    'oForm(Me.Tag).Mode = 1
'    'oForm(Me.Tag).Tag = Me.Tag
End Sub

'Add new record to the recordset
Public Sub TBNew()

    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, , , , True, True, , , True, True, , , , True
    txtTranNo.BackColor = &HE0FFFF
    Mode = AddNewEdit

    If rsHeader.State <> adStateOpen Then
        OpenNewConnection connHeader
        OpenNewConnection connParts
        OpenNewConnection connBuyout
        OpenNewConnection connLabor
        OpenRecordsetWithCN rsParts, "*", "WO_PARTS", connParts, "WHERE 1 = 0"
        OpenRecordsetWithCN rsBuyout, "*", "WO_BUYOUT", connBuyout, "WHERE 1 = 0"
        OpenRecordsetWithCN rsLabor, "*", "WO_LABOR", connLabor, "WHERE 1 = 0"
        OpenRecordsetWithCN rsHeader, "*", "WO", connHeader, "WHERE 1 = 0"
        SetDataSource
        SetDataField
    Else
        vBM = rsHeader.Bookmark
    End If

    rsHeader.AddNew
    rsHeader!cCompanyID = COID
    rsHeader!dDate = Date
    
    GetJODetails "", ""
    
    Set FrmName = Me
    FormLocking False
    ClrRequired &HC0&
    SSTab1.ActiveTab = 0
    SSTab2.ActiveTab = 0
    SSTab3.ActiveTab = 0
    txtRefJONo.Locked = True
    txtTranNo.SetFocus
    txtPCCode = sDivision

    'System generated number
    lSystemGenerated = GetValueFrTable("lBit", "SYSTEM_OPTION", "cCode = 'AUTO_NUMBER_WO' ")
    If lSystemGenerated Then rsHeader!cTranNo = GetAutoCtrlNo(rsHeader, "AUTO_NUMBER_WO", "WO", "cTranNo")
    
End Sub

'Undo all changes to the recordset
Public Sub TBUndoAll()
On Error GoTo ErrorHandler

    Mode = Normal
    
    If rsHeader.Status = adRecNew Then TBUndoCurrent
    
    rsHeader.CancelBatch adAffectAll
    rsParts.CancelBatch adAffectAll
    rsBuyout.CancelBatch adAffectAll
    rsLabor.CancelBatch adAffectAll
    
    UnbindControls
    
    If rsHeader.RecordCount <> 0 Then rsHeader.Bookmark = vBM
    
    Set FrmName = Me
    FormLocking True
    
    If rsHeader.RecordCount <> 0 Then
        BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, lACEdit, lACDelete, , , , lACCancel, , , True, True, lACPrint, True
    Else
        RSZero
        Mode = Find
    End If

    sbRS.Panels(2) = ""
    
    SetDataSource
    SetDataField
    
ErrorHandler:
    
    cboParts.Visible = False
    cboBuyout.Visible = False

    If err.Number = -2147217885 Then
        Resume Next
    ElseIf err.Number = -2147217842 Then 'Operation was cancelled. (Error returned by ITGDateBox)
        TBUndoAll
    End If

End Sub

'Undo changes on the current record
Public Sub TBUndoCurrent()
On Error GoTo ErrorHandler

    GetChild
    If rsHeader.Status = adRecNew Then
        rsParts.CancelBatch adAffectAll
        rsBuyout.CancelBatch adAffectAll
        rsLabor.CancelBatch adAffectAll
        rsHeader.CancelUpdate
    Else
        rsHeader.CancelBatch adAffectCurrent
        rsParts.CancelBatch adAffectAll
        rsBuyout.CancelBatch adAffectAll
        rsLabor.CancelBatch adAffectAll
    End If
   
    If rsHeader.RecordCount = 0 Then RSZero
    
ErrorHandler:
    If err.Number = -2147217885 Then
        Resume Next
    ElseIf err.Number = -2147217842 Then 'Operation was cancelled. (Error returned by ITGDateBox)
        TBUndoCurrent
    End If

End Sub

'Save all changes
Public Sub TBSave()
Dim OKUpdate As Boolean
On Error GoTo ErrHandler

    'Audit Trail
    lBoolean = False
    If rsHeader.Status = adRecNew Then lBoolean = True
    
    If Not MandatoryOK Then Exit Sub
    
    'System generated number
    If rsHeader.Status = adRecNew Then
    
    
        If lSystemGenerated Then
            If ChkCtrlNo(rsHeader, "AUTO_NUMBER_WO", "WO", "cTranNo", rsHeader!cTranNo) <> rsHeader!cTranNo Then
                GetChild
                
                rsHeader!cTranNo = strNo

                If rsParts.RecordCount <> 0 Then rsParts.MoveFirst
                Do Until rsParts.EOF
                    rsParts!cTranNo = strNo
                    rsParts.MoveNext
                Loop
                
                If rsBuyout.RecordCount <> 0 Then rsBuyout.MoveFirst
                Do Until rsBuyout.EOF
                    rsBuyout!cTranNo = strNo
                    rsBuyout.MoveNext
                Loop
                
                If rsLabor.RecordCount <> 0 Then rsLabor.MoveFirst
                Do Until rsLabor.EOF
                    rsLabor!cTranNo = strNo
                    rsLabor.MoveNext
                Loop
                GetChild
            End If
        End If
    End If
    
    OKUpdate = False
    cn.BeginTrans
    connHeader.BeginTrans
    connParts.BeginTrans
    connBuyout.BeginTrans
    connLabor.BeginTrans
    
    rsHeader.UpdateBatch adAffectAll
    rsParts.UpdateBatch adAffectAll
    rsBuyout.UpdateBatch adAffectAll
    rsLabor.UpdateBatch adAffectAll
    
    cn.CommitTrans
    connHeader.CommitTrans
    connParts.CommitTrans
    connBuyout.CommitTrans
    connLabor.CommitTrans
    OKUpdate = True
    
    Set FrmName = Me
    FormLocking True
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, lACEdit, lACDelete, , , , lACCancel, , , True, True, lACPrint, True
    Mode = Normal
    
    'Audit trail
    UpdateLogFile "Work Order", Trim(txtTranNo), IIf(lBoolean, "Inserted", "Updated")
    
    UpdateJO_RefWO rsHeader!cRefJONo, rsHeader!nRefIdentity, "'" & rsHeader!cTranNo & "'"

    'update system generated number
    If lBoolean Then
        If lSystemGenerated And strNo = rsHeader!cTranNo Then UpdateControlNo strNo, rsHeader!cTranNo, "AUTO_NUMBER_WO"
    End If
    
    MsgBox "Record/s successfully saved.", vbInformation, "ComUnion"
    sbRS.Panels(2) = ""
    
ErrHandler:
    cboParts.Visible = False
    cboBuyout.Visible = False
    If err.Number = -2147217885 Then
        Resume Next
    ElseIf err.Number = -2147217864 Then
        OKUpdate = True
        cn.RollbackTrans
        connHeader.RollbackTrans
        connParts.RollbackTrans
        connBuyout.RollbackTrans
        connLabor.RollbackTrans
        MsgBox "Record cannot be updated. Some values may have been changed by other user/s since last read." & vbCr & _
                "Records will be automatically refreshed. All changes made to the record will be gone upon refresh.", vbInformation, "ComUnion"
        vBookMark = rsHeader.Bookmark
        UnbindControls
        rsHeader.Requery
        rsParts.Requery
        rsBuyout.Requery
        rsLabor.Requery
        BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, lACEdit, lACDelete, , , , lACCancel, , , True, True, lACPrint, True
        Mode = Normal
        If rsHeader.RecordCount <> 0 Then
            Set FrmName = Me
            FormLocking True
            SetDataField
            SetDataSource
            rsHeader.Bookmark = vBookMark
        Else
            RSZero
        End If
    End If
    If Not OKUpdate Then
        MsgBox "Transaction update failed.", vbInformation, "ComUnion"
        cn.RollbackTrans
        connHeader.RollbackTrans
        connParts.RollbackTrans
        connBuyout.RollbackTrans
        connLabor.RollbackTrans
        ErrorLog err.Number, err.Description, Me.Name 'Error log
    End If
    
End Sub

'Sets the form & recorset to add/edit mode
Public Sub TBEdit()
    If rsHeader!lCancelled = True Then
        MsgBox "Transaction was already cancelled. Edit is not allowed.", vbExclamation, "ComUnion"
        Exit Sub
    End If
    If Not AllowEdit Then Exit Sub
    Mode = AddNewEdit
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, , , , True, True, , , True, True, , , , True
    Set FrmName = Me
    FormLocking False
    txtRefJONo.Locked = True
    ClrRequired &HC0&
    cmdPickJONo.Enabled = False
    txtTranNo.Locked = True
    SSTab1.ActiveTab = 0
    SSTab3.ActiveTab = 0
    dtbDate.SetFocus
    vBM = rsHeader.Bookmark
    EnableFATabs
End Sub

'Delete record
Public Sub TBDelete()
On Error GoTo ErrorHandler

Dim sRefJONo As String
Dim sRefIdentity As String

    sRefJONo = Trim(txtRefJONo)
    sRefIdentity = rsHeader!nRefIdentity
    sID = Trim(txtTranNo)
    
    If rsHeader.RecordCount = 0 Then Exit Sub

    If rsHeader!lCancelled = True Then
        MsgBox "Transaction was already cancelled. Deletion is not allowed.", vbExclamation, "ComUnion"
        Exit Sub
    End If
    
    If MsgBox("Are you sure you want to delete this record?", vbQuestion + vbYesNo, "ComUnion") = vbNo Then Exit Sub
    
    If Not AllowDelete("delete") Then Exit Sub
    
    GetChild
    If rsParts.RecordCount <> 0 Then
        rsParts.MoveFirst
        Do Until rsParts.RecordCount = 0
            rsParts.Delete adAffectCurrent
            If rsParts.RecordCount <> 0 Then rsParts.MoveFirst
        Loop
    End If
    If rsBuyout.RecordCount <> 0 Then
        rsBuyout.MoveFirst
        Do Until rsBuyout.RecordCount = 0
            rsBuyout.Delete adAffectCurrent
            If rsBuyout.RecordCount <> 0 Then rsBuyout.MoveFirst
        Loop
    End If
    If rsLabor.RecordCount <> 0 Then
        rsLabor.MoveFirst
        Do Until rsLabor.RecordCount = 0
            rsLabor.Delete adAffectCurrent
            If rsLabor.RecordCount <> 0 Then rsLabor.MoveFirst
        Loop
    End If
    
    'Audit trail
    UpdateLogFile "Work Order", Trim(txtTranNo), "Deleted"
    
    UpdateJO_RefWO sRefJONo, sRefIdentity, "NULL"

    rsHeader.Delete adAffectCurrent
    
    rsParts.UpdateBatch adAffectAll
    rsBuyout.UpdateBatch adAffectAll
    rsLabor.UpdateBatch adAffectAll
    rsHeader.UpdateBatch adAffectAll
    
    
    TBPrevRec

    Mode = Normal

    If rsHeader.RecordCount = 0 Then
        RSZero
    End If

ErrorHandler:
    If err.Number = -2147217885 Then
        Resume Next
    ElseIf err.Number = -2147217864 Then
        UpdateJO_RefWO sRefJONo, sRefIdentity, "NULL"
        cn.Execute "DELETE WO_PARTS WHERE cTranNo = '" & sID & "' AND cCompanyID = '" & COID & "'"
        cn.Execute "DELETE WO_BUYOUT WHERE cTranNo = '" & sID & "' AND cCompanyID = '" & COID & "'"
        cn.Execute "DELETE WO_LABOR WHERE cTranNo = '" & sID & "' AND cCompanyID = '" & COID & "'"
        cn.Execute "DELETE WO WHERE cTranNo = '" & sID & "' AND cCompanyID = '" & COID & "'"
        Resume Next
    End If

End Sub

'Search using the frmITGSearch
Public Sub TBFind()
    Mode = Normal
    txtTranNo.Locked = True
    frmITGSearch.Show 'vbModal
End Sub

'Search using the recordset primary key
Public Sub TBFindPrimary()
Dim sTemp As String
If Mode = Find Then
    FormWaitShow App.Path & "\Transmit.avi", "Loading data . . ."
            
    OpenNewConnection connHeader
    OpenNewConnection connParts
    OpenNewConnection connBuyout
    OpenNewConnection connLabor
    
    Set rsHeader = Nothing
    Set rsParts = Nothing
    Set rsBuyout = Nothing
    Set rsLabor = Nothing
    Set rsHeader = New ADODB.Recordset
    Set rsParts = New ADODB.Recordset
    Set rsBuyout = New ADODB.Recordset
    Set rsLabor = New ADODB.Recordset

    sTemp = Trim$(GetSearchString)
    If sTemp = "ERROR" Then
        MsgBox "Only Allows A - Z, 0 - 9, '.', ',' and %(wildcard)", vbExclamation, ""
        BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, , , , , , , , , True, , , True
        txtTranNo.Locked = False
        txtTranNo.SetFocus
        Exit Sub
    End If
    
    OpenRecordsetWithCN rsHeader, "*", "WO", connHeader, IIf(sTemp = "", "", " WHERE " & sTemp)
    'OpenRecordsetWithCN rsParts, "*", "WO_PARTS", connParts
    'OpenRecordsetWithCN rsBuyout, "*", "WO_BUYOUT", connBuyout
    'OpenRecordsetWithCN rsLabor, "*", "WO_LABOR", connLabor
                
    OpenRecordsetWithCN rsParts, "*", "WO_PARTS", connParts, IIf(sTemp = "", "", " WHERE cTranNo IN (SELECT cTranNo FROM WO WHERE " & sTemp & ")")
    OpenRecordsetWithCN rsBuyout, "*", "WO_BUYOUT", connBuyout, IIf(sTemp = "", "", " WHERE cTranNo IN (SELECT cTranNo FROM WO WHERE " & sTemp & ")")
    OpenRecordsetWithCN rsLabor, "*", "WO_LABOR", connLabor, IIf(sTemp = "", "", " WHERE cTranNo IN (SELECT cTranNo FROM WO WHERE " & sTemp & ")")
         
    Set FrmName = Me
    FormLocking True

    If rsHeader.RecordCount = 0 Then
        FormWaitHide
        MsgBox "No matching record/s found.", vbInformation, "ComUnion Search"
        RSZero
        FormSearch True
        SearchObj True
        Mode = Find
        Exit Sub
    End If
    SetDataSource
    SetDataField
    GetJODetails rsHeader!cRefJONo, rsHeader!nRefIdentity
    txtTranNo.BackColor = &HE0FFFF
    Mode = Normal
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, lACEdit, lACDelete, , , , lACCancel, , , True, True, lACPrint, True

    FormWaitHide
Else
    RSZero
    FormSearch True
    SearchObj True
    Mode = Find
   
End If
    
End Sub

'Reload menu buttons (do not delete this sub)
Public Sub TBBitReload()
    BitVisible ITGLedgerMain.tbrMain, True, True
    ITGLedgerMain.tbrMain.Buttons("btnFind").ButtonMenus("btnFindP").Enabled = True
    BitReload ITGLedgerMain, Me, ITGLedgerMain.tbrMain, sBit
    Set FrmName = Me
    dtgName = dtgBuyout.Name
End Sub

'Close active window
Public Sub TBCloseWindow()
    Unload Me
End Sub

'Move first
Public Sub TBFirstRec()
    If rsHeader.State <> adStateOpen Then Exit Sub
    MoveFirst rsHeader
    
End Sub

'Move previuos
Public Sub TBPrevRec()
    If rsHeader.State <> adStateOpen Then Exit Sub
    MovePrevious rsHeader
    
End Sub

'Move next
Public Sub TBNextRec()
    If rsHeader.State <> adStateOpen Then Exit Sub
    MoveNext rsHeader
    
End Sub

'Move last
Public Sub TBLastRec()
    If rsHeader.State <> adStateOpen Then Exit Sub
    MoveLast rsHeader

End Sub

'Add new line to the detail recordset
Public Sub TBNewLine()
    
    If rsHeader!cTranNo = "" Then Exit Sub
    
    If dtgName = "dtgParts" Then
        rsParts.AddNew
        rsParts!cCompanyID = COID
        rsParts!cTranNo = Trim(rsHeader!cTranNo)
        dtgParts.Col = 0
        dtgParts.Columns(0).Value = ""
        dtgParts.Columns(4).Value = 0
        dtgParts.Columns(5).Value = 0
        dtgParts.Columns(6).Value = 0
        GetChild
        If rsParts.RecordCount <> 0 Then rsParts.MoveLast
        dtgParts.SetFocus
    ElseIf dtgName = "dtgBuyout" Then
        rsBuyout.AddNew
        rsBuyout!cCompanyID = COID
        rsBuyout!cTranNo = Trim(rsHeader!cTranNo)
        dtgBuyout.Col = 0
        dtgBuyout.Columns(0).Value = ""
        dtgBuyout.Columns(4).Value = 0
        dtgBuyout.Columns(5).Value = 0
        dtgBuyout.Columns(6).Value = 0
        GetChild
        If rsBuyout.RecordCount <> 0 Then rsBuyout.MoveLast
        dtgBuyout.SetFocus
    ElseIf dtgName = "dtgLabor" Then
        rsLabor.AddNew
        rsLabor!cCompanyID = COID
        rsLabor!cTranNo = Trim(rsHeader!cTranNo)
        dtgLabor.Col = 0
        dtgLabor.Columns(0).Value = ""
        dtgLabor.Columns(2).Value = 0
        dtgLabor.Columns(3).Value = 0
        dtgLabor.Columns(4).Value = 0
        GetChild
        If rsLabor.RecordCount <> 0 Then rsLabor.MoveLast
        dtgLabor.SetFocus
    End If
    
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, , , , True, True, , , True, True, , , , True

End Sub

'Delete line in the detail recordset
Public Sub TBDeleteLine()
On Error GoTo ErrorHandler

    If dtgName = dtgParts.Name Then
        If rsParts.RecordCount = 0 Then Exit Sub
        vBookMark = dtgParts.Bookmark
        GetChild
        dtgParts.Bookmark = vBookMark
        rsParts.Delete adAffectCurrent
    ElseIf dtgName = dtgBuyout.Name Then
        If rsBuyout.RecordCount = 0 Then Exit Sub
        vBookMark = dtgBuyout.Bookmark
        GetChild
        dtgBuyout.Bookmark = vBookMark
        rsBuyout.Delete adAffectCurrent
    ElseIf dtgName = dtgLabor.Name Then
        If rsLabor.RecordCount = 0 Then Exit Sub
        vBookMark = dtgLabor.Bookmark
        GetChild
        dtgLabor.Bookmark = vBookMark
        rsLabor.Delete adAffectCurrent
    End If
    GetChild

    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, , , , True, True, , , True, True, , , , True

ErrorHandler:
    If err.Number = -2147217885 Then
        Resume Next
    End If

End Sub

'Undo All
Public Sub TBUndoLineAll()
On Error GoTo ErrorHandler

    MsgBox "Unavailable on " & Me.Name

ErrorHandler:
    If err.Number = -2147217885 Then
        Resume Next
    End If

End Sub

'Undo current line
Public Sub TBUndoLineCurrent()
    MsgBox "Unavailable on " & Me.Name
End Sub

'Post current record
Public Sub TBPostRecord()
    MsgBox "Unavailable on " & Me.Name
End Sub

'Cancel current record
Public Sub TBCancelRecord()
On Error GoTo ErrorHandler
    
    If rsHeader.RecordCount = 0 Then Exit Sub

    If rsHeader!lCancelled = True Then
        MsgBox "Transaction was already cancelled.", vbExclamation, "ComUnion"
        Exit Sub
    End If
    
    If MsgBox("Are you sure you want to cancel this record?", vbQuestion + vbYesNo, "ComUnion") = vbNo Then Exit Sub

    If Not AllowDelete("cancel") Then Exit Sub
    
    'Audit trail
    UpdateLogFile "Work Order", Trim(txtTranNo), "Cancelled"

    cn.Execute ("UPDATE WO SET lCancelled = 1 WHERE cTranNo = '" & Trim(txtTranNo) & "' AND cCompanyID = '" & COID & "'")
    
    UpdateJO_RefWO rsHeader!cRefJONo, rsHeader!nRefIdentity, "NULL"
    
    sbRS.Panels(5) = "CANCELLED"
    Mode = Normal
    
    rsHeader!lCancelled = True
    rsHeader.UpdateBatch adAffectAll

ErrorHandler:
    If err.Number = -2147217885 Then
        Resume Next
    End If

End Sub

'Print
Public Sub TBPrintRecord()
'    cModule = "WO_Order"
'    oPrint.PrintReceipt Trim(txtTranNo)
End Sub

'Sets the data source of the controls
Sub SetDataSource()
    Set FrmName = Me
    BindControls rsHeader
    Set dtgList.DataSource = rsHeader
    Set dtgParts.DataSource = rsParts
    Set dtgBuyout.DataSource = rsBuyout
    Set dtgLabor.DataSource = rsLabor
    
End Sub

'Sets the data field for every bounded controls
Sub SetDataField()
    With rsHeader
        txtTranNo.DataField = !cTranNo
        dtbDate.DataField = !dDate
        txtRefJONo.DataField = !cRefJONo
        dtbStarted.DataField = !dActualStart
        dtbFinished.DataField = !dActualFinish
        txtPCCode.DataField = !cPCCode
    End With
End Sub

Private Sub rsHeader_MoveComplete(ByVal adReason As ADODB.EventReasonEnum, ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)
On Error GoTo ErrorHandler

    If Not (rsHeader.EOF) Or Not (rsHeader.BOF) Then
        'Status bar setup
        sbRS.Panels(1) = "Record: " & IIf((rsHeader.AbsolutePosition = -2), "0", rsHeader.AbsolutePosition) & "/" & rsHeader.RecordCount

        If rsHeader.Status <> adRecNew Then
            txtTranNo.Locked = True
        Else
            txtTranNo.Locked = False
        End If

        If Mode = AddNewEdit Then
            Select Case rsHeader.Status
                Case adRecNew
                    sbRS.Panels(2) = "New"
                Case adRecModified
                    sbRS.Panels(2) = "Modified"
                Case Else
                    sbRS.Panels(2) = ""
            End Select
        Else
            sbRS.Panels(2) = ""
            GetJODetails rsHeader!cRefJONo, rsHeader!nRefIdentity
            If Trim(txtAssetType) = "Equipment" Then
                SSTab2.ActiveTab = 0
            ElseIf Trim(txtAssetType) = "Vehicle" Then
                SSTab2.ActiveTab = 1
            ElseIf Trim(txtAssetType) = "Vessel" Then
                SSTab2.ActiveTab = 2
            ElseIf Trim(txtAssetType) = "Others" Then
                SSTab2.ActiveTab = 3
            End If
        End If
        
        GetChild
    
        If rsHeader!lCancelled = True Then
            sbRS.Panels(5) = "CANCELLED"
        Else
            sbRS.Panels(5) = ""
        End If
    Else
        sbRS.Panels(1) = "Record: 0/0"
        sbRS.Panels(2) = ""
        txtTranNo.Locked = False
    End If

    If Mode = AddNewEdit Then
        dtgParts.Refresh
        dtgBuyout.Refresh
        dtgLabor.Refresh
    End If

ErrorHandler:
    'Err.Number -2147217885
    'Description - Row handle referred to a deleted row or a row marked for deletion.
    If err.Number = -2147217885 Then
        Resume Next
    End If

End Sub

Private Sub Timer1_Timer()
    If Mode = AddNewEdit Then
        SSTab1.TabEnabled(1) = False
    Else
        SSTab1.TabEnabled(1) = True
        SSTab_Normal
    End If
End Sub

Private Sub txtRemarks_LostFocus()
    If Mode <> AddNewEdit Then Exit Sub
    If rsBuyout.RecordCount = 0 Then TBNewLine
End Sub

Private Sub txtAssetID_Change()
    txtAssetDesc = ""
    txtAssetDesc = GetValueFrTable("cDesc", "ASSET", "cAssetNo = '" & Trim(txtAssetID) & "'")
    ClearFADetails
    If Trim(txtAssetDesc) <> "" Then
        If Trim(txtAssetType) = "Equipment" Then
            txtCategory = GetValueFrTable("cCategory", "ASSET", "cAssetNo = '" & Trim(txtAssetID) & "'")
            txtMarks = GetValueFrTable("cMark", "ASSET", "cAssetNo = '" & Trim(txtAssetID) & "'")
            txtLocation = GetValueFrTable("cLocation", "ASSET", "cAssetNo = '" & Trim(txtAssetID) & "'")
        ElseIf Trim(txtAssetType) = "Vehicle" Then
            txtVehicleType = GetValueFrTable("cVehicleType", "ASSET", "cAssetNo = '" & Trim(txtAssetID) & "'")
            txtVehicleMake = GetValueFrTable("cVehicleMake", "ASSET", "cAssetNo = '" & Trim(txtAssetID) & "'")
            txtVehicleModel = GetValueFrTable("cVehicleModel", "ASSET", "cAssetNo = '" & Trim(txtAssetID) & "'")
            txtVehicleDesc = GetValueFrTable("cVehicleDesc", "ASSET", "cAssetNo = '" & Trim(txtAssetID) & "'")
            txtVehiclePlateNo = GetValueFrTable("cVehiclePlateNo", "ASSET", "cAssetNo = '" & Trim(txtAssetID) & "'")
        ElseIf Trim(txtAssetType) = "Vessel" Then
            txtVesselNo = GetValueFrTable("cVesselNo", "ASSET", "cAssetNo = '" & Trim(txtAssetID) & "'")
            txtVesselName = GetValueFrTable("cVesselName", "ASSET", "cAssetNo = '" & Trim(txtAssetID) & "'")
            txtVesselEngine = GetValueFrTable("cVesselEngine", "ASSET", "cAssetNo = '" & Trim(txtAssetID) & "'")
        ElseIf Trim(txtAssetType) = "Others" Then
        End If
    End If
End Sub

Private Sub txtAssetType_Change()
    If Mode <> AddNewEdit Then Exit Sub
    EnableFATabs
End Sub

Private Sub txtPCCode_Change()
    txtPCDesc = ""
    txtPCDesc = GetValueFrTable("cDescription", "PROFITCENTER", "cPCCode = '" & Trim(txtPCCode) & "'")
End Sub

Private Sub txtPCCode_LostFocus()
    If Mode <> AddNewEdit Then Exit Sub
    If Trim(txtPCDesc) = "" And Trim(txtPCCode) <> "" Then cmdPickPC_Click
End Sub

Private Sub txtTranNo_LostFocus()
    'Does Code Already Exist
    If Mode = AddNewEdit Then
        If Trim(txtTranNo) = "" Then
            MsgBox "Empty primary input.", vbInformation, "ComUnion"
            If FrmName.Name <> Me.Name Then PreviousTab frmComUnionMenuTab
            txtTranNo.SetFocus
        Else
            If rsHeader.Status <> adRecNew Then Exit Sub
            txtTranNo = Trim(txtTranNo)
            If IDExisting(rsHeader, "cTranNo", "WO", Trim(rsHeader!cTranNo)) Then
                MsgBox "Work Order No. already exist.", vbInformation, "ComUnion"
                If FrmName.Name <> Me.Name Then PreviousTab frmComUnionMenuTab
                txtTranNo.SetFocus
            End If
        End If
    End If
End Sub

'Check if all mandatory fields are complete
Function MandatoryOK() As Boolean

    MandatoryOK = True

    If Trim(txtTranNo) = "" Then
        MandatoryOK = False
        MsgBox "Field 'Transaction Number' is mandatory. Null value is not allowed.", vbInformation, "ComUnion"
        txtTranNo.SetFocus
        Exit Function
    End If
    
    ComputeAmount rsParts, dtgParts.Name
    ComputeAmount rsBuyout, dtgBuyout.Name
    ComputeAmount rsLabor, dtgLabor.Name
    
    If rsHeader.Status = adRecNew And lSystemGenerated = False Then
        If IDExisting(rsHeader, "cTranNo", "WO", Trim(rsHeader!cTranNo)) Then
            MandatoryOK = False
            MsgBox "Work Order No. already exist.", vbInformation, "ComUnion"
            txtTranNo.SetFocus
            Exit Function
        End If
    End If

    'Required fields
    If Trim(dtbDate.Text) = "__/__/____" Then
        MandatoryOK = False
        MsgBox "Field 'Transaction Date' is mandatory. Null value is not allowed.", vbInformation, "ComUnion"
        dtbDate.SetFocus
        Exit Function
    ElseIf Trim(txtRefJONo) = "" Then
        MandatoryOK = False
        MsgBox "Field 'Reference JO No.' is mandatory. Null value is not allowed.", vbInformation, "ComUnion"
        txtRefJONo.SetFocus
        Exit Function
    End If
    
    GetChild
    
    'Transaction without details
    'If rsBuyout.RecordCount = 0 Then
    '    MandatoryOK = False
    '    MsgBox "Cannot save transaction without details.", vbInformation, "ComUnion"
    '    dtgBuyout.SetFocus
    '    Exit Function
    'End If
    
    If rsParts.RecordCount <> 0 Then rsParts.MoveFirst
    Do Until rsParts.EOF
        If rsParts.Status = (adRecNew) Or rsParts.Status = (adRecModified) Then
            If IsNull(rsParts!cItemNo) Then
                rsParts.Delete
            ElseIf Trim(rsParts!cItemNo) = "" Then
                rsParts.Delete
            Else
                rsParts.MoveNext
            End If
        Else
            rsParts.MoveNext
        End If
    Loop

    If rsBuyout.RecordCount <> 0 Then rsBuyout.MoveFirst
    Do Until rsBuyout.EOF
        If rsBuyout.Status = (adRecNew) Or rsBuyout.Status = (adRecModified) Then
            If IsNull(rsBuyout!cItemNo) Then
                rsBuyout.Delete
            ElseIf Trim(rsBuyout!cItemNo) = "" Then
                rsBuyout.Delete
            Else
                rsBuyout.MoveNext
            End If
        Else
            rsBuyout.MoveNext
        End If
    Loop

    If rsLabor.RecordCount <> 0 Then rsLabor.MoveFirst
    Do Until rsLabor.EOF
        If rsLabor.Status = (adRecNew) Or rsLabor.Status = (adRecModified) Then
            If IsNull(rsLabor!cEmpCode) Then
                rsLabor.Delete
            ElseIf Trim(rsLabor!cEmpCode) = "" Then
                rsLabor.Delete
            Else
                rsLabor.MoveNext
            End If
        Else
            rsLabor.MoveNext
        End If
    Loop
    
    GetChild

    'If rsBuyout.RecordCount < 1 Then
    '    MsgBox "Cannot save transaction without 'Parts' details.", vbExclamation, "ComUnion"
    '    MandatoryOK = False
    '    Exit Function
    'End If

End Function

'Filter detail recordset to header's primary
Private Sub GetChild()
    rsParts.Filter = "cTranNo = '" & Trim(rsHeader!cTranNo) & "'"
    rsBuyout.Filter = "cTranNo = '" & Trim(rsHeader!cTranNo) & "'"
    rsLabor.Filter = "cTranNo = '" & Trim(rsHeader!cTranNo) & "'"
End Sub

'Sets the form if record number is zero
Private Sub RSZero()
    sbRS.Panels(1) = "Record: 0/0"
    sbRS.Panels(2) = ""
    sbRS.Panels(4) = ""
    sbRS.Panels(5) = ""
    
    Set dtgParts.DataSource = Nothing
    Set dtgBuyout.DataSource = Nothing
    Set dtgLabor.DataSource = Nothing
    dtgParts.Refresh
    dtgBuyout.Refresh
    dtgLabor.Refresh
    
    Set FrmName = Me
    UnbindControls
    TextClearing
    FormLocking True
    
    If rsHeader.State = adStateOpen Then rsHeader.Close
    If rsParts.State = adStateOpen Then rsParts.Close
    If rsBuyout.State = adStateOpen Then rsBuyout.Close
    If rsLabor.State = adStateOpen Then rsLabor.Close
    
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, , , , , , , , , True, , , True
    
    txtTranNo.Locked = False
    txtTranNo.SetFocus
    
    Mode = Find
    
End Sub

Sub SearchObj(lEnable As Boolean)
    dtbDate.Enabled = lEnable
End Sub

Private Function AllowEdit() As Boolean
    AllowEdit = True
    
    'PROVIDE CRITERIA

End Function

Private Function AllowDelete(sAction As String) As Boolean
    AllowDelete = True
    
    'PROVIDE CRITERIA

End Function

'Form list to grid
Public Sub AddDetailsFromList()

    rsHeader!cRefJONo = Trim(frmEnhanceJOList.mRefPK)
    rsHeader!nRefIdentity = CDbl(frmEnhanceJOList.lvwList.SelectedItem.SubItems(6))
    GetJODetails rsHeader!cRefJONo, rsHeader!nRefIdentity
    
End Sub

Private Sub GetJODetails(sRefNo As String, sRefIdentity As String)
    If Trim(sRefNo) <> "" Then
        'From JO_T
        txtService = GetValueFrTable("cService", "JO_T", "cTranNo = '" & Trim(sRefNo) & "' AND nIdentity = " & sRefIdentity & " ")
        txtDeptID = GetValueFrTable("DeptID", "JO_T", "cTranNo = '" & Trim(sRefNo) & "' AND nIdentity = " & sRefIdentity & " ")
        txtDeptDesc = GetValueFrTable("DeptDesc", "JO_T", "cTranNo = '" & Trim(sRefNo) & "' AND nIdentity = " & sRefIdentity & " ")
        Dim sDate As String
        sDate = GetValueFrTable("dToStart", "JO_T", "cTranNo = '" & Trim(sRefNo) & "' AND nIdentity = " & sRefIdentity & " ")
        dtbEstToStart.Text = IIf(Trim(sDate) = "", "__/__/____", Format(sDate, "mm/dd/yyyy"))
        sDate = GetValueFrTable("dEstToFinish", "JO_T", "cTranNo = '" & Trim(sRefNo) & "' AND nIdentity = " & sRefIdentity & " ")
        dtbEstToFinish.Text = IIf(Trim(sDate) = "", "__/__/____", Format(sDate, "mm/dd/yyyy"))
        'From JO
        txtPCCode = GetValueFrTable("cPCCode", "JO", "cTranNo = '" & Trim(sRefNo) & "'")
        txtAssetType = GetValueFrTable("cAssetType", "JO", "cTranNo = '" & Trim(sRefNo) & "'")
        txtAssetID = GetValueFrTable("cAssetNo", "JO", "cTranNo = '" & Trim(sRefNo) & "'")
        txtVehicleKM = GetValueFrTable("nVehicleKM", "JO", "cTranNo = '" & Trim(sRefNo) & "'")
        
    Else
        txtService = Empty
        txtDeptID = Empty
        txtDeptDesc = Empty
        dtbEstToStart.Text = "__/__/____"
        dtbEstToFinish.Text = "__/__/____"
        txtAssetType = Empty
        txtAssetID = Empty
        txtVehicleKM = Empty
    End If
End Sub

Private Function GetSearchString() As String
On Error GoTo ErrorHandler
Dim sWhere As String

    GetSearchString = True

    If Trim$(txtTranNo.Text) <> "" Then
        sWhere = sWhere & IIf(Trim$(sWhere) = "", "", " AND ") & " cTranNo LIKE '" & Trim$(txtTranNo.Text) & "%'"
    End If

    If Trim$(dtbDate.Text) <> "__/__/____" Then
        sWhere = sWhere & IIf(Trim$(sWhere) = "", "", " AND ") & " dDate = '" & Trim$(dtbDate.Text) & "'"
    End If
    
    If Trim$(txtRefJONo.Text) <> "" Then
        sWhere = sWhere & IIf(Trim$(sWhere) = "", "", " AND ") & " cRefJONo LIKE '" & Trim$(txtRefJONo.Text) & "%'"
    End If
    
    GetSearchString = Trim$(sWhere)

    Exit Function
ErrorHandler:
    GetSearchString = "ERROR"
End Function

Private Sub ClearFADetails()
    txtCategory = Empty
    txtMarks = Empty
    txtLocation = Empty
    txtVehicleType = Empty
    txtVehicleMake = Empty
    txtVehicleModel = Empty
    txtVehicleDesc = Empty
    txtVehiclePlateNo = Empty
    txtVesselNo = Empty
    txtVesselName = Empty
    txtVesselEngine = Empty
    txtVehicleKM = Empty
End Sub

Private Sub EnableFATabs()
    If Trim(txtAssetType) = "Equipment" Then
        SSTab2.ActiveTab = 0
        SSTab2.TabEnabled(0) = True
        SSTab2.TabEnabled(1) = False
        SSTab2.TabEnabled(2) = False
        SSTab2.TabEnabled(3) = False
    ElseIf Trim(txtAssetType) = "Vehicle" Then
        SSTab2.ActiveTab = 1
        SSTab2.TabEnabled(0) = False
        SSTab2.TabEnabled(1) = True
        SSTab2.TabEnabled(2) = False
        SSTab2.TabEnabled(3) = False
    ElseIf Trim(txtAssetType) = "Vessel" Then
        SSTab2.ActiveTab = 2
        SSTab2.TabEnabled(0) = False
        SSTab2.TabEnabled(1) = False
        SSTab2.TabEnabled(2) = True
        SSTab2.TabEnabled(3) = False
    ElseIf Trim(txtAssetType) = "Others" Then
        SSTab2.ActiveTab = 3
        SSTab2.TabEnabled(0) = False
        SSTab2.TabEnabled(1) = False
        SSTab2.TabEnabled(2) = False
        SSTab2.TabEnabled(3) = True
    End If
End Sub

'Gets initital item values
Private Sub GetInitialItemValues(RefRS As Recordset)
    RefRS!cItemType = "Trade"
    RefRS!cDesc = Trim(GetValueFrTable("cDesc", "ITEM", "cItemNo = '" & Trim(RefRS!cItemNo) & "'")) & ""
    RefRS!cUnit = Trim(GetValueFrTable("cUnit", "ITEM", "cItemNo = '" & Trim(RefRS!cItemNo) & "'")) & ""
End Sub

'Gets initital asset values
Private Sub GetInitialAssetValues(RefRS As Recordset)
    RefRS!cItemType = "Asset"
    RefRS!cDesc = Trim(GetValueFrTable("cDesc", "ASSET", "cAssetNo = '" & Trim(RefRS!cItemNo) & "'")) & ""
    RefRS!cUnit = "Unit" 'Trim(GetValueFrTable("cUnit", "ITEM", "cItemNo = '" & Trim(RefRS!cItemNo) & "'")) & ""
End Sub

'Gets initital asset values
Private Sub GetInitialSupplyValues(RefRS As Recordset)
    RefRS!cItemType = "Supply"
    RefRS!cDesc = Trim(GetValueFrTable("cDesc", "SUPPLY", "cSupplyNo = '" & Trim(RefRS!cItemNo) & "'")) & ""
    RefRS!cUnit = Trim(GetValueFrTable("cUnit", "SUPPLY", "cSupplyNo = '" & Trim(RefRS!cItemNo) & "'")) & ""
End Sub

'Computes total amount per detail line
Private Sub ComputeAmount(RefRS As Recordset, RefDTG As String)
Dim nAmount As Double
    If Mode <> AddNewEdit Then Exit Sub
    If RefRS.RecordCount = 0 Then Exit Sub
    If RefDTG = dtgParts.Name Then
        With dtgParts
            nAmount = IIf(IsNull(.Columns(4).Value), 0, .Columns(4).Value) * _
                        IIf(IsNull(.Columns(5).Value), 0, .Columns(5).Value)
            .Columns(6).Text = Format(nAmount, "###,##0.#0")
        End With
    ElseIf RefDTG = dtgBuyout.Name Then
        With dtgBuyout
            nAmount = IIf(IsNull(.Columns(4).Value), 0, .Columns(4).Value) * _
                        IIf(IsNull(.Columns(5).Value), 0, .Columns(5).Value)
            .Columns(6).Text = Format(nAmount, "###,##0.#0")
        End With
    ElseIf RefDTG = dtgLabor.Name Then
        With dtgLabor
            nAmount = IIf(IsNull(.Columns(2).Value), 0, .Columns(2).Value) * _
                        IIf(IsNull(.Columns(3).Value), 0, .Columns(3).Value)
            .Columns(4).Text = Format(nAmount, "###,##0.#0")
        End With
    End If
End Sub

Private Sub UpdateJO_RefWO(sRefNo As String, sRefIdentity As String, sValue As String)

    cn.Execute ("UPDATE JO_T SET cWONo = " & sValue & " " & _
                "WHERE cCompanyID = '" & COID & "' AND cTranNo = '" & sRefNo & "' " & _
                "AND nIdentity = '" & sRefIdentity & "'")

End Sub

Private Sub SSTab_Normal()
    SSTab2.TabEnabled(0) = True
    SSTab2.TabEnabled(1) = True
    SSTab2.TabEnabled(2) = True
    SSTab2.TabEnabled(3) = True
End Sub

'Public Sub ShowForm(sTranNo As String)
'    If Mode = Find Then
'
'        OpenNewConnection connHeader
'        OpenNewConnection connParts
'        OpenNewConnection connBuyout
'        OpenNewConnection connLabor
'
'        Set rsHeader = Nothing
'        Set rsParts = Nothing
'        Set rsBuyout = Nothing
'        Set rsLabor = Nothing
'        Set rsHeader = New ADODB.Recordset
'        Set rsParts = New ADODB.Recordset
'        Set rsBuyout = New ADODB.Recordset
'        Set rsLabor = New ADODB.Recordset
'
'        OpenRecordsetWithCN rsParts, "*", "WO_PARTS", connParts, "WHERE cTranNo = '" & Trim(sTranNo) & "'"
'        OpenRecordsetWithCN rsBuyout, "*", "WO_BUYOUT", connBuyout, "WHERE cTranNo = '" & Trim(sTranNo) & "'"
'        OpenRecordsetWithCN rsLabor, "*", "WO_LABOR", connLabor, "WHERE cTranNo = '" & Trim(sTranNo) & "'"
'        OpenRecordsetWithCN rsHeader, "*", "WO", connHeader, "WHERE cTranNo = '" & Trim(sTranNo) & "'"
'
'        Set FrmName = Me
'        FormLocking True
'
'        If rsHeader.RecordCount = 0 Then
'            FormWaitHide
'            MsgBox "No matching record/s found.", vbInformation, "ComUnion Search"
'            RSZero
'            FormSearch True
'            SearchObj True
'            Mode = Find
'            Exit Sub
'        End If
'            SetDataSource
'            SetDataField
'            txtTranNo.BackColor = &HE0FFFF
'            Mode = Normal
'            oBar.BitEnabled Me, ITGLedgerMain.tbrMain, lACNew, lACEdit, lACDelete, , , , , , , True, True, , True, True
'
'    End If
'End Sub
'
'

